<template>
	<div class="yesterday">
		<span>{{ nowMonth }}月{{ nowDay }}日</span>
		<div class="xian"></div>
		<div>
			<ul>
				<li v-for="item in list " :key="item.id" @click="jump(item.id)">
				<div class="item_left">
					<p class="p1">{{ item.title }}</p>
					<p class="p2">{{ item.hint }}</p>
				</div>
				<div class="item_right">
					<img :src="item.images[0]">
				</div>
				<div class="clear"></div>
				</li>
			</ul>
		</div>
	</div>
	
</template>

<script>
	export default{
		data(){
			return{
				nowMonth:null,
				nowDay:null,
				list:[]
			}
		},
		mounted() {
			this.getTime()
			this.getlist()
		},
		methods:{
			getTime(){
				let data = new Date()
				let month = data.getMonth()+1
				let day = data.getDate()
				
				this.month=check(month)
				this.day=check(day)
				
				function check(i){
					let num = (i<10)?("0"+i) : i;
					return num;
				}
				this.nowDay = this.day-1
				this.nowMonth = this.month
			},
			getlist:function(){
				this.$http.get('http://chonghekj.com/daily/index.php/Home/daily/before',{
					params:{
						date:20200721
					}
				})
				.then((res)=>{
					// console.log(res)
					this.list = res.data.stories
				})
			},
			jump:function(id){
				console.log(id)
				this.$router.push({
					path:'/xq',
					query:{id}
				})
			}
		}
	}
</script>

<style lang="less">
	.yesterday{
		overflow: hidden;
		span{
			display: inline-block;
			float: left;
			padding: 10px;
			font-size: 16px;
			width: 20%;
		}
		.xian{
			float: right;
			width: 78%;
			height: 1px;
			background: #646566;
			margin-top: -20px;
		}
	}
	
</style>
